<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 例如 输入1234 输出4321 使用递归不能用全局变量 只能传递一个参数
      function reserve(value) {
        let result = String(value % 10);
        value = parseInt(value / 10);
        if (value > 9) {
          result += reserve(value);
        } else {
          result += value;
        }
        return result;
      }
      console.log(reserve(10));
    </script>
  </body>
</html>
